import java.sql.*;
public class Test01 {
	/*private static final String DRIVER ="oracle.jdbc.driver.OracleDriver";
	  private static final String URL = "jdbc:oracle:thin:@Carson-AA:1521:XE";
	  private static final String USERNAME = "carson";
	  private static final String PASSWORD= "12345";*/
	
	public static void main(String[] args){
		try{
			Connection conn = JDBCUtil.getConnection(); //good
			/*Class.forName(DRIVER);  //load driver
			  Connection conn = DriverManager.getConnection(URL,USERNAME,PASSWORD);*/
			Statement st = conn.createStatement();
			//Insert a record
			int n = st.executeUpdate("insert into Sample values('Steven',72)");  //return n record changed
			System.out.println(n+"records are inserted.");
			//Read all records
			ResultSet rs = st.executeQuery("select * from Sample"); //return ResultSet
			while (rs.next()){  //Pointer
				System.out.println(rs.getString("Name")+"\t"+rs.getInt("Age"));
			}
			rs.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}

